function constant() = 42

function square(x) = x * x

function charAt(str, idx) = str[idx]

moduleVar = 3
function plusModuleVar(x) = x + moduleVar
function plusModuleVar2(x) = "x: \(x) moduleVar: \(moduleVar)"
function nameShadowing(moduleVar) = moduleVar

local localVar = 4
function timesLocalVar(x) = x * localVar

function thisFn() = this.moduleVar

function argCapture(x, y) = new Dynamic { value = x + y + x }

function nestedCapture(a) = new Dynamic {
  b = 3
  c {
    d = a
    x {
      a = 5
      y {
        z = a
      }
    }
  }
}

res1 = constant()
res2 = square(3)
res3 = charAt("abcdef", 4)
res4 = plusModuleVar(8)
res5 = plusModuleVar2(5)
res6 = nameShadowing(7)
res7 = timesLocalVar(2)
res8 = thisFn()
res9 = this.thisFn()
res10 = argCapture(4, 5).value
res11 = nestedCapture(99)
